<?php

class view {
	private $filename;

	function __construct($aether) {
		$this->aether = $aether;
		$this->c = $aether->controller;
		$this->m = $aether->models;
		$this->h = $aether->helpers;
		$this->module = $aether->getModule().'/';
		require($this->aether->loader->load($this->c->getTemplate(), 'this', 'template'));
	}
	
	private function yield() {
		if($this->aether->getModule()=='app' OR $this->aether->getModule()=='core') {
			$fn = $this->aether->getModule();
		} else {
			$fn = 'plugins/'.$this->aether->getModule();
		}
		$fn .= '/views/'.$this->getParam('controller').'/'.$this->getParam('action').'.php'; //Filename
		if(file_exists($fn)) {
			require($fn);
		} else {
			$this->aether->errorHandler->trigger('viewNotFound', array('filename' => $fn, 'action' => $this->getParam('action'), 'controller' => $this->getParam('controller'), 'module' => $this->aether->getModule()));
		}
	}

	private function getVar($name) {
		return $this->c->getVar($name);
	}

	private function getParam($name) {
		return $this->c->getParam($name); 
	}
}	

?>
